﻿using System;
using System.Configuration;
//+
namespace General
{
    public static class ConfigurationFacade
    {
        //- @ApplicationSettings -//
        public static String ApplicationSettings(String key)
        {
            String value = ConfigurationManager.AppSettings[key];
            if (String.IsNullOrEmpty(value))
            {
                throw new ConfigurationErrorsException(String.Format("{0} is required in the application configuration file", key));
            }
            //+
            return value;
        }

        //- @ConnectionString -//
        public static String ConnectionString(String key)
        {
            String value = ConfigurationManager.ConnectionStrings[key].ConnectionString;
            if (String.IsNullOrEmpty(value))
            {
                throw new ConfigurationErrorsException(String.Format("{0} is required in the application configuration file", key));
            }
            //+
            return value;
        }
    }
}